#include "Demo.h"

#include "DemoDialog.h"

Demo::Demo(QWidget* parent)
	: QCustomWidget(parent)
{
	ui.setupUi(this);

	addTitleBar(ui.Caption);

	connect(this, &Demo::windowStateChanged, ui.BtnMaximize,
		[this](auto windowState)
		{
			if (windowState == Qt::WindowState::WindowMaximized)
			{
				ui.BtnMaximize->setChecked(true);
			}
			else if (windowState == Qt::WindowState::WindowNoState)
			{
				ui.BtnMaximize->setChecked(false);
			}
		});

	connect(ui.BtnMaximize, &QPushButton::clicked, this, &QCustomWidget::showMaximized);
	connect(ui.BtnShowDialog, &QPushButton::clicked, this, [=]()
		{
			DemoDialog demoDialog;
			demoDialog.exec();

		});
}

Demo::~Demo()
{}
